﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;

namespace POC.Controls
{
    public class WindowBase : Window
    {
        public CloseCommand CloseCommand { get; set; }

        public WindowBase()
        {
            CloseCommand = new CloseCommand(this.Close, this.CanExecute);
            this.Loaded += WindowBase_Loaded;
            this.DataContext = this;
        }

        private void WindowBase_Loaded(object sender, RoutedEventArgs e)
        {
            VisualHelper.FindVisualChild<DockPanel>(this).MouseLeftButtonDown += WindowBase_MouseLeftButtonDown;
        }

        public void WindowBase_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            this.DragMove();
        }

        public bool CanExecute()
        {
            return true;
        }
    }
}
